<?php

class RolsController extends AppController {
    
    public $layout = "admin";

    public $sl_roles = array(
        "actions" => array("V" => "view", "E" => "edit", "D" => "delete"),
        "filters" => array(
            array("name" => 'Rol.nombre', "label" => 'Nombre')
        ),
        "columns" => array(
            array("name" => 'Rol.nombre', "label" => 'Nombre')
        )
    );
    public $maint_roles = array(
        "fields" => array(
            "Descripción del Rol" => array(
				array("name" => "fecha_carga", "label" => "Fecha Carga", "presentation" => "DATETIME", 'classparams' => '{"force":true}', 'isvisible' => false, "actions" => "A"),
                array("name" => 'nombre', "label" => 'Nombre')
            )
        ),
        "tables" => array(
            "Permisos" => array(
                "plugin" => "admin",
                "model" => "Permiso",
                "fields" => array(
                    array("name" => 'nombre', "label" => 'Permiso')
                ),
                "order" => array('Permiso.controller ASC', 'Permiso.nombre ASC')
            ),
            "Botones" => array(
                "plugin" => "admin",
                "model" => "Button",
                "fields" => array(
                    array("name" => 'description', "label" => 'Descripción')
                ),
                "order" => array('Button.description ASC')
            )
        )
    );

    public function add() {
        $this->maint = $this->maint_roles;
        parent::add();
    }

    public function edit($id = null) {
        $this->maint = $this->maint_roles;
        parent::edit($id);
    }

    public function index() {
        $this->search_list = $this->sl_roles;
        parent::index();
    }

    public function view($id = null) {
        $this->maint = $this->maint_roles;
        parent::view($id);
    }

}